<%-- 
    Document   : useProperty
    Created on : Jun 17, 2013, 7:13:04 PM
    Author     : Acer
--%>

<%@page import="java.util.Date"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">

<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>Using Sessions to Track Users</title>
    </head>
    <body>
        <%
                    Integer counter = (Integer) session.getAttribute("counter");
                    if (counter == null) {
                        counter = new Integer(1);
                    } else {
                        counter = new Integer(counter.intValue() + 1);
                    }

                    session.setAttribute("counter", counter);
        %>
        <h1>Using Sessions to Track Users</h1>
        Session ID: <%=session.getId()%><br/>
        Session creation time:<%=new Date(session.getCreationTime())%><br/>
        Last accessed time: <%=new Date(session.getLastAccessedTime())%><br/>
        Number of times you've been here:<%=counter%>
    </body>
</html>
